import {defineConfig} from 'vite'
import vue from '@vitejs/plugin-vue'
import path from 'path'

// https://vitejs.dev/config/
export default defineConfig({
    base: './',
    plugins: [vue()],
    // 打包配置
    build: {
        minify: 'terser',
        terserOptions: {
            compress: {
                // 移除console方法
                drop_console: true,
                drop_debugger: true
            }
        }
    },
    resolve: {
        // 配置别名 像vue-cli一样以@方式引入文件
        alias: {
            '@': path.resolve(__dirname, './src')
        }
    },
    css: {
        preprocessorOptions: {
            less: {
                javascriptEnabled: true
            }
        }
    },
    server: {
        open: true,
        proxy: {
            '/api': {
                // target: 'https://1.13.246.69/',
                target: 'http://127.0.0.1:8082/',
                changeOrigin: true,
                pathRewrite: {
                    '^/api': '/'
                },
                secure: false
            }
        }
    }
})
